home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 2
/
Gold Medal Software Volume 2 (Gold Medal) (1994).iso
/
comms
/
reglw2os.arj
/
SCRTUT.DOC
< prev
next >
Wrap
Text File
|
1993-07-30
|
9KB
|
220 lines
L i v e W i r e C o m m u n i c a t i o n s 2.0
S c r i p t L e a r n T u t o r i a l
Copyright 1991 Les Novell
Introduction to Scripting
LiveWire 2.0 allows you to automate several communications
tasks such as logging into services such as BBSs, capturing
messages for later reading, sending messages, and
sending/receiving files.
After showing LiveWire how to accomplish these tasks you can
set it so that at a certain time of the day it will dial into the
system without any human intervention.
This is scripting, and it has a lot of uses. It might be
useful as a time saver for slow typists. It could also dial into
a long distance or heavily used services in the middle of the
night when rates are low. It can be set up so your own computer
can answer phone calls, allowing callers to receive files or send
messages.
Basically, scripting gives you the freedom to program your
computer to do just about any communication task you need. But
you don't need to be a programmer to write useful scripts. In
fact, LiveWire can write (or "Learn") simple scripts for you.
There are three types of people who use scripts: those who
let LiveWire or someone else write them scripts and do not know
how scripts actually work; those who let LiveWire or someone else
write their scripts but in addition know enough to make changes;
and those who use the script language to its full extent,
allowing them to do more complex tasks. Most casual users fit in
the first category.
1. Using LiveWire to learn scripts
LiveWire has the capability to record part or all of a
communications session and play it back automatically. This is
called script learn.
LiveWire accomplishes this "recording" by assuming that the
service you are connected to will be sending a prompt (eg: Enter
Your Name: or Press any key...) and that you will respond by
typing a response and pressing ENTER. LiveWire remembers what you
type at each prompt and simply responds in the same manner next
time it sees these prompts.
Let's run through an example learning session.
The first thing you must do is find a service you want to
call in your phone directory and put a filename in the "Script"
field. To edit this entry press "E" while the highlight bar is on
the entry. When the edit window appears move your highlight bar
to the entry "Script" and press ENTER. Now type a filename
(maximum of eight letters) into this field and press ENTER. Then
press Esc to save this entry.
Now dial the service. Note that as you dial an "L" appears
next to the entry where a check normally appears. This means that
LiveWire will automatically start learning as soon as you get
onto the service.
Logon normally to the service, but take note of how much of
your logon you want LiveWire to remember. For example, on most
services you would only need LiveWire to remember when you type
your name and password. Beyond this (reading bulletins and
messages) the service you call probably changes daily. If so,
LiveWire will become confused. It isn't smart enough to adapt to
these changes.
When you're ready to have LiveWire stop learning look at the
status line on your screen. It will tell you what keys you need
to press to stop script learning.
That's it! Next time you call the same service LiveWire
should automatically replay what it learned, key for key. If for
some reason LiveWire did not learn correctly or you made a
mistake while it was learning you can change the name of the
script filename in the phone book entry or erase the script file.
TIPS FOR LEARNING:
LiveWire makes the assumption that when you press ENTER you
are finished typing so...
- Press ENTER after each prompt
- The use of hotkeys (selection of an option without having
to press ENTER) may not work
2. Editing a script
Inside learned scripts
After a script has been learned by LiveWire modifications
may be necessary. Even computers make mistakes once in a while,
right? Since LiveWire uses a simple learning method it is not
difficult to edit learned scripts. Learned scripts do two things:
Wait for a prompt and send a response. In scripting this boils
down to something as simple as:
Find "Enter Your Name: "
Delay 100
Send "Les Novell^M"
These are the basic commands in any learned script. Here's
an example learned script
** LiveWire Learned Script File
** Set timeout and timeout subroutine
Set TimeOut=60
OnTimeOut timeouterror
** Set emulation and toggles
Emulation 1
Echo 0
Linefeeds 0
XonXoff 1
BSIsDel 0
Status 1
Doorway 0
:StartScript
Find "Press" <--Find "Press"
Delay 100
Send "^[^[" <--Send two ESCs
Find "ter your full name: " <--Find "Enter your full
name:"
Delay 100
Send "les novell^M" <--Send my name and ENTER
Find "le ...^M^J^J^MPassword: "<--Find Password Prompt
Delay 100
Send "xxxxxx^M" <--Send my password and ENTER
Find "▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓^M^J▓ " <--Find end of logon screen
Delay 100
Send "^M" <--Send ENTER to continue
Find "Return] to continue:"
Delay 100
Send "^M"
Halt
Although this may be a bit confusing at first, there are a
couple of things to keep in mind. First, LiveWire has no way of
knowing how much of the text is a prompt. Therefore, it considers
the last 20 letters as the prompt. This may cause more than one
line to be considered a prompt or may cut off part of a prompt.
This should not cause any problems but may cause the learned
script to look a little odd.
Another thing which may look odd are the ^M, ^J and ^[.
These indicate control characters. ^M is equal to Control-M.
Control-M, incidentally, is the ENTER key. Control-J is linefeed.
Control-[ is the escape key on your keyboard. Whenever you want
to simulate the ENTER key you would stick in a ^M.
Editing a script file
Editing a script file associated with a service in the
dialer is simple. Go into the dialer and move the highlight bar
to the service, then press the V (for View Script) key. After a
few seconds an editor will come up with the learned script.
If you intend to fix the script, the first thing you need to
know is at what point the script is failing. For example, if the
script never responds to a "PASSWORD:" prompt then you know that
it is not recognizing the prompt correctly.
Move your cursor to the place in the script which has the
command to find the password prompt. This may look like:
Find "PASSWORD:"
Any small difference in the actual prompt and the prompt LiveWire
expects will cause a problem. Some things to look for are:
+ Time/Date dependent information is part of the prompt
EG: "(23 minutes left) COMMAND:"
this should be changed to "COMMAND:"
+ Spaces where they do not belong
+ Odd control (^) characters
+ Line noise
+ The system prompt changed since you learned the script!
Change the prompt the script file is looking for using
standard editing keys (insert, delete, arrow keys) and save the
script by pressing ALT-X. If you make a huge mistake and want to
abort the script press and hold CTRL-K then press A for Abort.
Debugging a script
If you are debugging a script that is too complex or you
can't seem to fix there are two special debugging commands for
scripts. The first, DEBUG, displays the currently executing
script command on the status line. The second, DEBUGDELAY, slows
down the script so that you can see what is being displayed on
the status line. To start debug insert the following commands at
the top of your script:
DEBUG ON
DEBUGDELAY 150
Where DEBUG ON turns on debug and DEBUGDELAY 150 sets a
delay of 150 milliseconds between script commands. If you can't
read a line of script every 150 milliseconds, you can increase
the delay. Delays of over 500 are usually excruciatingly slow.
To turn debug off in portions of the script you know are
correct, issue the commands:
DEBUG OFF
DEBUGDELAY 0
These are the default settings for DEBUG. These debugging
tools provide a simple trace-through feature. I realize they may
be inadequate for large projects because you still cannot view
variables and stack while the script is running. In this case you
must write your own script code to provide some debug
information.